<template>
	<view class="content" style="padding-bottom: 150rpx;">
		<!-- <u-sticky> -->
		<!-- 一级tab栏 -->
		<view class="header paddinglr ffffff" :style="{paddingTop:systemBarHeight+'rpx'}">
			<view class="headerBox flexbetween">
				<view style="position: relative;" :class="headerTabActive==index?'select':'noselect'"
					v-for="(item,index) in headerTab" :key="index" @click="selectTab(index)">
					<view class="box flexleft" v-if="index==0">
						<u-badge max="99" :value="ordergoods_total_num"></u-badge>
					</view>
					<view class="box flexleft" v-if="index==1">
						<u-badge type="warning" max="99" :value="0"></u-badge>
					</view>
					<view class="box flexleft" v-if="index==2">
						<u-badge max="99" :value="ordercall_total_num"></u-badge>
					</view>
					<view class="box flexleft" v-if="index==3">
						<u-badge max="99" :value="ordermake_hotel_total_num"></u-badge>
					</view>
					{{item.name}}
				</view>
			</view>
		</view>
		<view class="flexcenter ffffff padding_top1" v-if="headerTabActive==3">
			<view class="all1" :class="yystatus==1?'checkall':''" @click="changeyystatus(1)">
				<text>預約</text>
				<view class="box flexleft">
					<u-badge max="99" :value="ordermake_total_num"></u-badge>
				</view>
			</view>
			<view class="all3" :class="yystatus==2?'checkall':''" @click="changeyystatus(2)">
				<text>住宿</text>
				<view class="box flexleft">
					<u-badge max="99" :value="hotel_total_num"></u-badge>
				</view>
			</view>
		</view>
		<!-- 二级tab栏 -->
		<view class="ffffff padding_top1">
			<u-tabs :list="tabList" @click="change" :current="tabActive" lineWidth="50rpx" keyName="title"
				lineColor="rgba(255, 184, 0, 1)" :activeStyle="{
				  color: '#000000',
				  fontWeight: 800,
				  transform: 'scale(1.05)'}" :inactiveStyle="{
				  color: '#666666',
				     fontWeight: 800,
				    transform: 'scale(1)'
				}" itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;"></u-tabs>
		</view>
		<!-- </u-sticky> -->
		<!-- 訂單列表 -->
		<!-- 商品 -->
		<view class="flexcenter" v-if="!list.data.length && ((headerTabActive==0&&tabActive!=0) || headerTabActive!=0)">
			<view class="placeholderimage" style="margin-top: 100rpx;"></view>
		</view>
		<view class="flexcenter" v-if="headerTabActive==0&&tabActive==0 && !carAllList.length">
			<view class="placeholderimage" style="margin-top: 100rpx;"></view>
		</view>
		<view class="mainpadding2" v-if="headerTabActive==0">
			<!-- 购物车 -->
			<view v-show="tabActive==0">
				<view class="mainpadding ffffff margin_top" v-for="shopitem in carAllList" :key="shopitem.shop_id">
					<view class="flexleft word_wrap" style="width: 550rpx;" @click.stop="goShopInfo(shopitem.shop_id)">
						<image class="shopImg margin_right1" src="/static/images/order/shop.png" mode=""></image>
						<view class="text_x color_ling margin_right1 yihang" v-if="shopitem.shop_name">
							{{shopitem.shop_name}}
						</view>
						<u-icon name="arrow-right" color="#999" size="16"></u-icon>
					</view>
					<view class="" v-for="(item,index) in shopitem.goodslist" :key="index">
						<view class="mainpadding border2 ffffff padding_bottom positionr">
							<view class="flexleft">
								<view class="goodsImg margin_right3">
									<image :src="item.logoimage_text" mode=""></image>
								</view>
								<!-- <view class="number" v-if="item.salename">{{item.salename}}</view> -->
								<view class="flex1 justify_between_column" style="height: 157rpx;">
									<view class="text_a color_san bold" v-if="item.salename">【{{item.salename}}】</view>
									<view class="text_a color_san bold">{{item.goods_name}}</view>
									<view class="text_b color_six flexbetween margin_top1" v-if="item.wei || item.hei">
										<text>尺寸：{{item.wei}}*{{item.hei}}</text>
										<text>用量：{{item.formulacount}}{{item.size}}</text>
									</view>
									<view class="xiaolan" v-if="item.spunatdata_text && item.spunatdata_text.length">
										規格：<text class="margin_right1" v-for="(value) in item.spunatdata_text"
											:key="value.spunatid">{{value.spunatname}}*{{value.num}}</text></view>
									<view class="flexbetween">
										<view class="price">${{item.d_price}}&nbsp;&nbsp;&nbsp;x{{item.num}}</view>
										<view class="text_six color_orange">${{item.price}}</view>
									</view>
								</view>
							</view>
							<view class="xiaolan smalltext margin_top" v-if="item.childdata.length">商品規格一</view>
							<view class="flexleft margin_top1" v-for="ite in item.childdata" :key="ite.id">
								<view class="goodsImg margin_right3">
									<image :src="ite.logoimage_text" mode=""></image>
								</view>
								<view class="number" v-if="ite.salename">{{ite.salename}}</view>
								<view class="flex1 justify_between_column" style="height: 157rpx;">
									<view class="text_a color_san bold">{{ite.goods_name}}</view>
									<view class="text_b color_six flexbetween margin_top1" v-if="ite.wei || ite.hei">
										<text>尺寸：{{ite.wei}}*{{ite.hei}}</text>
										<text>用量：{{ite.formulacount}}{{ite.size}}</text>
									</view>
									<view class="xiaolan" v-if="ite.spunatdata_text && ite.spunatdata_text.length">
										規格：<text class="margin_right1" v-for="(value) in ite.spunatdata_text"
											:key="value.spunatid">{{value.spunatname}}*{{value.num}}</text></view>
									<view class="flexbetween">
										<view class="price">${{ite.d_price || 0}}&nbsp;&nbsp;&nbsp;x{{ite.num}}</view>
										<view class="text_six color_orange">${{ite.price}}</view>
									</view>
								</view>
							</view>
							<view class="ffffff line_top margin_top">
								<view class="flexright margin_top">
									<view class="flexleft margin_right2" @click="removeCart(item.id)">
										<u-icon name="trash" class="margin_right1" color="#777" size="18"></u-icon>
										<view class="text_b color_san">刪除</view>
									</view>
									<view class="flexleft margin_right2" @click="edititem(item)">
										<u-icon name="edit-pen" class="margin_right1" color="#777" size="18"></u-icon>
										<view class="text_b color_san">編輯</view>
									</view>
								</view>
							</view>
						</view>
					</view>
					<view class="flexright">
						<view class="orangeBtn" @click.stop="goFinalOrderInfo(shopitem)">結帳</view>
					</view>
				</view>
			</view>
			<!-- 订單 -->
			<view v-show="tabActive!=0">
				<view class="border2 ffffff mainpadding margin_bottom3" v-if="tabActive!=0" v-for="item in list.data"
					:key="item.id" @click="goGoodsOrderInfo(item.id)">
					<view class="flexbetween">
						<view class="flexleft word_wrap" style="width: 550rpx;" @click.stop="goShopInfo(item.shop_id)">
							<text style="font-size: 40rpx;color: #019891;margin-right: 10rpx;" class="bold"
								v-if="item.order_type==3">時</text>
							<text style="font-size: 40rpx;color: #37a621;margin-right: 10rpx;" class="bold"
								v-if="item.order_type==2">預</text>
							<image class="shopImg margin_right1" src="/static/images/order/shop.png" mode=""></image>
							<view class="text_x color_ling margin_right1 yihang">{{item.shop_data}}</view>
							<u-icon name="arrow-right" color="#999" size="16"></u-icon>
						</view>
						<view class="text_x color_red">#{{item.call_no}}</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="text_b color_jiu yihang" style="width: 360rpx;">{{item.order_sn}}</view>
						<view class="text_b color_jiu">{{secondDate(item.createtime,0,0)}}</view>
					</view>
					<view class="margin_top mainpadding priceBox">
						<view class="flexbetween">
							<view class="flexleft">
								<view class="stateBox text_e color3 color_green margin_right1" v-show="item.type==0">外送
								</view>
								<view class="stateBox text_e color2 margin_right1" v-show="item.type==1">自取</view>
								<view class="stateBox text_e color1 margin_right1" v-show="item.type==2">内用</view>
								<view class="text_x color_orange" v-show="item.status==100">購物車</view>
								<view class="text_x color_orange" v-show="item.status==0">待支付</view>
								<view class="text_x color_orange" v-show="item.status==1">待接單</view>
								<view class="text_x color_orange" v-show="item.status==2">製作中</view>
								<view class="text_x color_orange" v-show="item.status==5">待取貨</view>
								<view class="text_x color_orange" v-show="item.status==6">配送中待接單</view>
								<view class="text_x color_orange" v-show="item.status==7">配送中待取貨</view>
								<view class="text_x color_orange" v-show="item.status==8">配送中</view>
								<view class="text_x color_orange" v-show="item.status==9">已送達</view>
								<view class="text_x color_orange" v-show="item.status==87">待完成</view>
								<view class="text_x color_green" v-show="item.status==88">已完成</view>
								<view class="text_x xiaohui" v-show="item.status==99">已取消</view>
								<view class="hong_text titletext bold" style="margin-left: 10rpx;"
									v-if="item.type==2&&item.desk && item.desk!=-1">
									{{item.desk}}
								</view>
							</view>
							<view class="text_x color_orange">${{Number(item.paymoney) + Number(item.zhuimoney)}}</view>
						</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==0">請在提交訂單後10分鐘内完成支付</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==1">等待商家接單</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==2">商家正在配貨中</view>
						<view class="text_b color_jiu margin_top" v-show="item.type==1&&item.status==5">商家配貨完成，等待您到店取貨
						</view>
						<view class="text_b color_jiu margin_top" v-show="item.type==0&&item.status==5">商家配貨完成，等待騎手接單
						</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==6">配送中,等待騎手接單</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==7">已接單,等待騎手取貨</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==8">配送中,請耐心等待</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==9">已送達</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==87">商家待完成</view>
						<view class="text_b color_jiu margin_top" v-show="item.status==88">訂單已完成</view>
					</view>
					<view class="flexbetween margin_top2">
						<view class=" flexleft" v-if="item.opentype!=-1">
							<view class="xiaolan main_size lanlable" v-if="item.opentype==0">紙本</view>
							<view class="xiaolan main_size lanlable" v-if="item.opentype==1">載具</view>
							<view class="xiaolan main_size lanlable" v-if="item.opentype==2">統編</view>
							<view class="xiaolan main_size lanlable" v-if="item.opentype==3">捐贈</view>
							<view v-if="item.tbcode" class="bold xiaolan margin_left1 ershib">{{item.tbcode}}</view>
						</view>
						<view class="bold flexbetween" v-if="item.fpinfo && item.opentype!=-1">
							<text class="weikailist" v-if="item.fpinfo && item.fpinfo.is_ly==1">未列印</text>
							<text class="yikailist" v-if="item.fpinfo && item.fpinfo.is_ly==2">已列印</text>
							<view class="margin_right1" :class="item.fpinfo.status==3?'xiaohong':'xiaolan'">
								發票編號：{{item.fpinfo.invoice_number}}</view>
							<view class="xiaohong bold" v-show="item.fpinfo.status==3">作廢</view>
						</view>
					</view>
					<view class="flexbetween margin_top" v-if="item.paypz_image_text">
						<view class="xiaohei main_size">支付憑證</view>
						<image class="listleftimg1 radius" :src="item.paypz_image_text" mode=""
							@click.stop="lbtpriview(0,[item.paypz_image_text])"></image>
					</view>
					<view class="flexright margin_top text_x color_red" v-if="Number(item.zhuimoney)">
						未付：${{item.zhuimoney}}
					</view>
					<view class="xiaohui margin_top bold textright">
						共{{item.total_num || 0}}件，合計：
						<text class="xiaohuang">${{item.countmoney || 0}}</text>
						<text>，優惠${{item.yh_money || 0}}，已付：${{item.paymoney || 0}}，</text>
						<text class="xiaohong">未付：${{item.zhuimoney || 0}}</text>
					</view>
					<view class="flexright flex-wrap">
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==1 && item.status!=0">
							點數支付
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==2">多元支付
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==3">現金支付
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==4">信用卡
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==5">Line Pay線上支付
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==6">街口線上支付
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==7">街口線下支付
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==8">Line Pay線下支付
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==9">Line Pay二維碼支付
						</view>
						<view class="huang_text margin_top main_size bold " v-show="item.paytype==10">街口二維碼支付
						</view>
						<view class="greyBtn margin_top margin_left1" v-show="item.status==0"
							@click.stop="cancelOrder(item.id)">
							取消訂單</view>
						<view class="orangeBtn margin_top margin_left1" v-show="item.status==0"
							@click.stop="pzshow=true;currentid=item.id;uppzflag=1">上傳憑證</view>
						<view class="orangeBtn margin_top margin_left1" v-show="item.status==0"
							@click.stop="oncePay(item)">立即付款</view>
						<view class="orangeBtn margin_top margin_left1"
							v-show="item.type==2 && Number(item.desk)<=0 && item.status==1" @click.stop="xzth(item.id)">
							掃二維碼</view>
						<view class="greyBtn margin_top margin_left1"
							v-show="item.type==2&&item.desk && item.desk!=-1 && item.status<=87"
							@click.stop="fuwuling(item)">服務鈴</view>
						<view class="greyBtn margin_top margin_left1"
							v-show="item.status==2||item.status==5||item.status==6 || item.status==7 || (item.status==8 && (item.ps_type==1 || item.ps_type==2))">
							查看訂單
						</view>
						<view class="orangeBtn margin_top margin_left1"
							v-show="Number(item.zhuimoney) && (item.status==87 || item.status==88) && item.order_type!=2 && item.order_type!=3"
							@click.stop="jxPay(item)">立即付款
						</view>
						<view class="orangeBtn margin_top margin_left1"
							@click.stop="goSelectGoods(item.shop_id,item.id)"
							v-show="item.type==2 && item.order_type!=2 && item.order_type!=3 && item.status!=88">
							點餐</view>
						<!-- <view class="orangeBtn margin_top margin_left1" v-show="item.status==2||item.status==5">聯係
						</view> -->
						<view class="orangeBtn margin_top" v-show="item.status==7">聯係騎手</view>
						<view class="greyBtn margin_top margin_left1" v-show="item.status==8 && item.ps_type==0"
							@click.stop="show=true;shopfreight_num=item.shopfreight_num">查看物流</view>
						<view class="orangeBtn margin_top margin_left1"
							v-show="(item.status==8 && item.ps_type==0) || item.status==9"
							@click.stop="suresh(item.id)">
							確認收貨</view>
						<!-- <view class="greyBtn margin_top margin_left1" v-show="item.status==88"
							@click.stop="removeOrder(item.id)">刪除訂單
						</view> -->
						<!-- <view class="orangeBtn margin_top margin_left1" v-show="item.status==88">查看發票</view> -->
						<view class="orangeBtn margin_top margin_left1" v-show="item.status==88 && item.is_ping==0"
							@click.stop="goPublishEvaluate(item,1)">去評價</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 跑腿 -->
		<view class="mainpadding" v-if="headerTabActive==1">
			<view class="ffffff border2 mainpadding margin_bottom3" v-for="(item,index) in list.data" :key="item.id"
				@click="goRunErrandsOrderInfo(item.id)">
				<view class="flexbetween padding_bottom line_bottom">
					<!-- <view class="flexleft">
						<view class="stateBox text_e color1 margin_right1" v-show="index==0">帮买</view>
						<view class="stateBox text_e  color3 color_green margin_right1" v-show="index==1">帮送</view>
						<view class="text_x color_ling" v-show="index==0">帮我取</view>
						<view class="text_x color_ling" v-show="index==1">帮我送</view>
					</view> -->
					<view class="text_weight color_san">{{http.timereturn(item.createtime *1000)}}</view>
					<!-- <view class="text_a flexright color_red" v-show="item.status==0">待接單</view> -->
					<view class="text_a flexright color_red" v-show="item.status==0">待支付</view>
					<view class="text_a flexright color_red" v-show="item.status==1 && item.is_run==0">待接單</view>
					<view class="text_a flexright color_red" v-show="item.status==1 && item.is_run==1">待取貨</view>
					<view class="text_a flexright color_red" v-show="item.status==1 && item.is_run==2">配送中</view>
					<view class="text_a flexright color_red" v-show="item.status==1 && item.is_run==3">待確認</view>
					<view class="text_a flexright color_jiu" v-show="item.status==88">已取消</view>
					<view class="text_a flexright color_green" v-show="item.status==2">已完成</view>
				</view>
				<view class="flex margin_top">
					<view class="takeBox margin_right2">
						<image src="/static/images/order/take.png" mode=""></image>
					</view>
					<view class="flex1">
						<view class="text_weight color_san">{{item.to_name}} {{item.to_phone}}</view>
						<view class="margin_top text_a color_jiu">{{item.to_address}}</view>
					</view>
				</view>
				<view class="flex margin_top">
					<view class="takeBox margin_right2">
						<image src="/static/images/order/deliver.png" mode=""></image>
					</view>
					<view class="flex1">
						<view class="text_weight color_san">{{item.go_name}} {{item.go_phone}}</view>
						<view class="margin_top text_a color_jiu">{{item.go_address}}</view>
					</view>
				</view>
				<view class="padding_bottom line_bottom">
					<view class="mainpadding margin_top priceBox text_five color_six">{{item.bei}}</view>
				</view>
				<view class="flexright margin_top">
					<view class="text_a color_orange">合計：${{item.z_money}}</view>
				</view>
				<view class="flexright margin_top">
					<view class="greyBtn" v-show="item.status==2 || item.status==88" @click.stop="removeOrder(item.id)">
						刪除訂單</view>
					<view class="greyBtn margin_left" v-show="item.status==0 || (item.status==1 && item.is_run==0)"
						@click.stop="cancelOrder(item.id)">取消訂單</view>
					<view class="orangeBtn margin_left" v-show="item.status==0" @click.stop="paypt(item)">立即付款</view>
					<view class="orangeBtn margin_left"
						v-show="item.status==1 && (item.is_run==1 || item.is_run==2 || item.is_run==3)"
						@click.stop="callphone(item.takeaway.phone)">聯係騎手</view>
					<view class="orangeBtn margin_left" v-show="item.status==1 && item.is_run==3"
						@click.stop="overptdd(item)">完成訂單</view>
					<view class="orangeBtn margin_left" v-show="item.status==2 && item.is_ping==0"
						@click.stop="goPublishEvaluate(item,2)">去評價</view>
					<!-- <view class="orangeBtn margin_left" v-show="tabActive==3&&index==1">查看評價</view> -->
				</view>
			</view>
		</view>
		<!-- 呼叫 -->
		<view class="mainpadding" v-if="headerTabActive==2">
			<view class="border2 ffffff mainpadding margin_bottom3" v-for="(item,index) in list.data" :key="item.id"
				@click="goCallOrderInfo(item)">
				<view class="flexbetween">
					<view class="flexleft word_wrap" style="width: 400rpx;" @click.stop="goShopInfo(item.shop_id)">
						<image class="shopImg margin_right1" src="/static/images/order/shop.png" mode=""></image>
						<view class="text_x color_ling margin_right1 yihang">{{item.shop_data}}</view>
						<u-icon name="arrow-right" color="#999" size="16"></u-icon>
					</view>
					<view class="text_x color_red">#{{item.call_no}}</view>
				</view>
				<view class="flexbetween margin_top">
					<view class="text_b color_jiu">{{item.order_sn}}</view>
					<view class="text_b color_jiu">{{secondDate(item.createtime,0,0)}}</view>
				</view>
				<view class="margin_top mainpadding priceBox">
					<view class="flexbetween">
						<view>
							<view class="text_x color_orange" v-show="item.status==0">待接單</view>
							<view class="text_x color_orange" v-show="item.status==1">待服務</view>
							<view class="text_x color_orange" v-show="item.status==3">待完成</view>
							<view class="text_x color_orange" v-show="item.status==87">付定金</view>
							<view class="text_x color_yellow" v-show="item.status==5">待完成</view>
							<view class="text_x color_orange" v-show="item.status==4">付尾款</view>
							<view class="text_x color_orange" v-show="item.status==88">已取消</view>
							<view class="text_x color_green" v-show="item.status==99">已完成</view>
						</view>
						<view class="text_x color_orange" v-show="item.status==87">${{item.d_money}}</view>
						<view class="text_x color_orange" v-show="item.status==4">${{item.w_money}}</view>
					</view>
					<view class="text_b color_jiu margin_top" v-show="item.status==0">請您耐心等待商家接單</view>
					<view class="text_b color_jiu margin_top" v-show="item.status==1">請您耐心等待服務</view>
					<view class="text_b color_jiu margin_top" v-show="item.status==3">待完成，請等待</view>
					<view class="text_b color_jiu margin_top" v-show="item.status==87">請您及时支付定金！</view>
					<view class="text_b color_jiu margin_top" v-show="item.status==5">商家正在爲您提供服務！</view>
					<view class="text_b color_jiu margin_top" v-show="item.status==4">請您及时支付尾款！</view>
					<view class="text_b color_jiu margin_top" v-show="item.status==88">已取消此訂單</view>
					<view class="text_b color_jiu margin_top" v-show="item.status==99">感謝您的支持，期待您的下次光臨！</view>
				</view>
				<view class="flexbetween margin_top2">
					<view class=" flexleft" v-if="item.opentype!=-1">
						<view class="xiaolan main_size lanlable" v-if="item.opentype==0">紙本</view>
						<view class="xiaolan main_size lanlable" v-if="item.opentype==1">載具</view>
						<view class="xiaolan main_size lanlable" v-if="item.opentype==2">統編</view>
						<view class="xiaolan main_size lanlable" v-if="item.opentype==3">捐贈</view>
						<view v-if="item.tbcode" class="bold xiaolan margin_left1 ershib">{{item.tbcode}}</view>
					</view>
					<view class="bold flexbetween" v-if="item.fpinfo && item.opentype!=-1">
						<text class="weikailist" v-if="item.fpinfo && item.fpinfo.is_ly==1">未列印</text>
						<text class="yikailist" v-if="item.fpinfo && item.fpinfo.is_ly==2">已列印</text>
						<view class="margin_right1" :class="item.fpinfo.status==3?'xiaohong':'xiaolan'">
							發票編號：{{item.fpinfo.invoice_number}}</view>
						<view class="xiaohong bold" v-show="item.fpinfo.status==3">作廢</view>
					</view>
				</view>
				<view class="flexbetween margin_top" v-if="item.image_text">
					<view class="xiaohei main_size">定金支付憑證</view>
					<image class="listleftimg1 radius" :src="item.image_text" mode=""
						@click.stop="lbtpriview(0,[item.image_text])"></image>
				</view>
				<view class="flexbetween margin_top" v-if="item.image1_text">
					<view class="xiaohei main_size">尾款支付憑證</view>
					<image class="listleftimg1 radius" :src="item.image1_text" mode=""
						@click.stop="lbtpriview(0,[item.image1_text])"></image>
				</view>
				<view class="xiaohui margin_top bold textright" v-if="item.status==87 || item.status==88">
					合計：
					<text class="xiaohuang">${{item.count_money || 0}}</text>
					<text>，訂金${{item.d_money || 0}}</text>
					<text>，已付：$0，</text>
					<text class="xiaohong">未付：${{item.count_money || 0}}</text>
				</view>
				<view class="xiaohui margin_top bold textright" v-if="item.status==4">
					合計：
					<text class="xiaohuang">${{item.count_money || 0}}</text>
					<text>，尾款${{item.w_money || 0}}</text>
					<text>，已付：${{item.d_money || 0}}，</text>
					<text class="xiaohong">未付：${{Number(item.count_money) - Number(item.d_money) || 0}}</text>
				</view>
				<view class="xiaohui margin_top bold textright" v-if="item.status==99">
					合計：
					<text class="xiaohuang">${{item.count_money || 0}}</text>
					<text>，已付：${{item.count_money || 0}}，</text>
					<text class="xiaohong">未付：0</text>
				</view>
				<view class="flexright margin_top">
					<view class="greyBtn" v-show="item.status==0 || item.status==87" @click.stop="cancelOrder(item.id)">
						取消訂單</view>
					<view class="orangeBtn margin_left1" v-show="item.status==0">聯係</view>
					<view class="orangeBtn margin_left1" v-show="item.status==87" @click.stop="Paydj(item)">立即付款</view>
					<view class="orangeBtn margin_left1" v-show="item.status==4" @click.stop="Paywk(item)">立即付款</view>
					<view class="orangeBtn margin_left1" v-show="item.status==87"
						@click.stop="pzshow=true;currentid=item.id;uppzflag=2">上傳憑證</view>
					<view class="orangeBtn margin_left1" v-show="item.status==4"
						@click.stop="pzshow=true;currentid=item.id;uppzflag=4">上傳憑證</view>
					<!-- <view class="greyBtn margin_left1" v-show="item.status==99 || item.status==88"
						@click.stop="removeOrder(item.id)">刪除訂單
					</view> -->
					<!-- <view class="orangeBtn margin_left1" v-show="item.status==99">查看發票</view> -->
					<view class="orangeBtn margin_left1" v-show="item.status==99 && item.is_ping==0"
						@click.stop="goPublishEvaluate(item,3)">去評價</view>
				</view>
			</view>
		</view>
		<!-- 預約 -->
		<view class="mainpadding" v-if="headerTabActive==3">
			<!-- 預約 -->
			<template v-if="yystatus==1">
				<view class="border2 ffffff mainpadding margin_bottom3" v-for="(item,index) in list.data" :key="item.id"
					@click="goyuyueOrderInfo(item.id)">
					<view class="flexbetween">
						<view class="flexleft word_wrap" style="width: 400rpx;" @click.stop="goShopInfo(item.shop_id)">
							<text style="font-size: 40rpx;color: #019891;margin-right: 10rpx;" class="bold"
								v-if="item.order_goods&&item.order_goods.order_type==3">時</text>
							<image class="shopImg margin_right1" src="/static/images/order/shop.png" mode=""></image>
							<view class="text_x color_ling margin_right1 yihang">{{item.shop_data}}</view>
							<u-icon name="arrow-right" color="#999" size="16"></u-icon>
						</view>
						<view class="flexleft">
							<view class="text_x color_red margin_right2" v-show="item.desk && item.desk!=-1">
								{{item.desk}}
							</view>
							<view class="text_x color_red" v-if="item.order_goods">排號：{{item.order_goods.call_no}}
							</view>
						</view>
					</view>
					<view class="flexbetween margin_top2">
						<view class="text_x color_san">客戶名稱：{{item.username}}</view>
						<text class="text_x color_yellow">{{item.crnum+item.oldnum+item.ernum}}人</text>
					</view>
					<view class="text_a color_jiu margin_top2">客戶電話：{{item.phone}}</view>
					<view class="text_a color_jiu margin_top2">預約時間：{{item.yuefenzu}} {{item.yuetime}}</view>
					<view class="margin_top2 xiaolan" v-if="item.fpinfo">
						<view>發票編號：{{item.fpinfo.invoice_number}}</view>
					</view>
					<view class="text_a color_jiu margin_top2" v-show="item.status==1">
						到店時間：{{secondDate(item.ddtime,0,0)}}</view>
					<view class="text_a color_jiu margin_top2" v-show="item.status==1 && item.prev_num">
						您的前面還有<text class="hong_text">{{item.prev_num}}</text>人</view>
					<view class="text_a color_jiu margin_top2" v-show="item.status==88">
						取消時間：{{secondDate(item.updatetime,0,0)}}</view>
					<view class="flexbetween margin_top2" v-if="item.image_text">
						<view class="xiaohei main_size">支付憑證</view>
						<image class="listleftimg1 radius" :src="item.image_text" mode=""
							@click.stop="lbtpriview(0,[item.image_text])"></image>
					</view>
					<view class="flexbetween margin_top2" v-if="item.order_goods_list.length">
						<view class="text_a color_ling">訂單編號：{{item.order_goods.order_sn}}</view>
						<view class="text_x color_red" v-if="item.order_goods.call_no">#{{item.order_goods.call_no}}
						</view>
					</view>
					<view class="xiaohui margin_top2 bold textright" v-if="item.order_goods">
						共{{item.total_num || 0}}件，合計：
						<text class="xiaohuang">${{item.order_goods.countmoney || 0}}</text>
						<text>，優惠${{item.order_goods.yh_money || 0}}，已付：${{item.order_goods.paymoney || 0}}，</text>
						<text class="xiaohong">未付：${{item.order_goods.zhuimoney || 0}}</text>
					</view>
					<view class="flexbetween margin_top2 line_top" style="align-items: flex-start;">
						<view class="text_a margin_top2  color_yellow" style="min-width: 100rpx;"
							v-show="item.status==0">未到店
						</view>
						<view class="text_a margin_top2 color_theme" style="min-width: 100rpx;"
							v-show="item.status==1||item.status==2">已到店</view>
						<view class="text_a margin_top2 color_green" style="min-width: 100rpx;"
							v-show="item.status==99">
							已完成
						</view>
						<view class="text_a margin_top2 color_jiu" style="min-width: 100rpx;" v-show="item.status==88">
							已取消
						</view>
						<view class="flexright flex_wrap">
							<view class="greyBtn margin_top2 margin_right3" v-show="item.status==0"
								@click.stop="cancelOrder(item.id)">取消預約
							</view>
							<view class="orangeBtn margin_top2" v-show="item.status==0" @click.stop="reach(item)">掃店家碼
							</view>
							<view class="greyBtn margin_top2" v-show="item.status==2" @click.stop="fuwuling(item)">服務鈴
							</view>
							<!-- 普通預約訂單點餐 -->
							<view class="orangeBtn margin_top2 margin_left1"
								@click.stop="goSelectGoods(item.shop_id,item.order_goods_id)"
								v-show="item.status==2 && item.order_goods_id && item.order_goods.order_type!=3">點餐
							</view>
							<!-- 計時點餐 -->
							<view class="orangeBtn margin_top2 margin_left1"
								@click.stop="gocdbSelectGoods(item.shop_id,item.id,item.order_goods.cdbtc_id)"
								v-show="item.status==2 && item.order_goods_id && item.order_goods.order_type==3">分享
							</view>
							<view class="orangeBtn margin_top2 margin_left1"
								@click.stop="gocdbSelectGoods(item.shop_id,item.id,item.order_goods.cdbtc_id)"
								v-show="item.status==2 && item.order_goods_id && item.order_goods.order_type==3">點餐
							</view>
							<view class="orangeBtn margin_top2 margin_left1" @click.stop="jiezhang(item)"
								v-show="item.status==2 && item.order_goods && Number(item.order_goods.zhuimoney)">結帳
							</view>
							<view class="orangeBtn margin_top2 margin_left1"
								v-show="item.status==2 && item.order_goods && Number(item.order_goods.zhuimoney)"
								@click.stop="pzshow=true;currentid=item.id;uppzflag=3">上傳憑證</view>
							<view class="greyBtn margin_top2" v-show="item.status==99||item.status==88"
								@click.stop="removeOrder(item.id)">刪除記錄</view>
						</view>
					</view>
				</view>
			</template>
			<!-- 住宿 -->
			<template v-if="yystatus==2">
				<view class="mainpadding margin_bottom3 ffffff radius" v-for="(item,index) in list.data" :key="item.id"
					@click="jumpdetail('/pages_order/zhusuxq?id=',item.id)">
					<view class="flexleft word_wrap" style="width: 550rpx;" @click.stop="goShopInfo(item.shop_id)">
						<image class="shopImg margin_right1" src="/static/images/order/shop.png" mode=""></image>
						<view class="text_x color_ling margin_right1 yihang">{{item.shop.name}}</view>
						<u-icon name="arrow-right" color="#999" size="16"></u-icon>
					</view>
					<view class="flexbetween margin_top">
						<view class=" xiaohei titletext  bold">{{item.order_no}}</view>
						<view class="xiaohong" v-if="item.order_status==10">待支付</view>
						<view class="xiaohuang" v-if="item.order_status==20">待入住</view>
						<view class="xiaolv" v-if="item.order_status==30">已入住</view>
						<view class="xiaohui" v-if="item.order_status==40">已完成</view>
						<view class="xiaohuang" v-if="item.order_status==50">取消審核中</view>
						<view class="xiaohui" v-if="item.order_status==60">已取消</view>
					</view>
					<view class="flexleft margin_top">
						<image :src="item.shoptable.image_text" class="goodsImg margin_right3" mode=""></image>
						<view class="flexcolumnbet" style="width: 100%;height: 157rpx;">
							<view class="xiaohei titletext">{{item.shoptable.num}} <text style="font-size: 26rpx;"
									class="xiaolan margin_left2">{{(item.house_name && item.shoptable.num!=item.house_name)?item.house_name:""}}</text>
							</view>
							<view class="flexleft">
								<view class="" v-for="(ite,itedex) in item.gg_content_text" :key="itedex">
									<text class="xiaohui" style="color: #00a0e9;" v-for="(it,itdex) in ite.content"
										:key="itdex">
										<text class="margin_right1" v-show="it.num!=0">{{it.name}}*{{it.num}}</text>
									</text>
								</view>
							</view>
							<view class="eshiliu bold" v-show="item.shoptable.des" style="color: #333;">
								{{item.shoptable.des}}
							</view>
							<view class="xiaohei main_size flexleft flex_wrap">
								<view class="margin_right1 guigek" v-for="(it,ind) in item.shoptable.fwss_text"
									:key="it">{{it}}</view>
							</view>
							<view class="flexbetween" style="width: 100%;">
								<view class="xiaohong main_size">${{item.pay_price}}</view>
								<view class="xiaohui main_size">{{item.days}}晚 *{{item.house_num}}閒</view>
							</view>
						</view>
					</view>
					<view class="text_a color_jiu margin_top1">入住時間：{{item.start_date_text}}</view>
					<view class="text_a color_jiu margin_top1">結束時間：<text
							class="huang_text text_a">{{item.end_date_text}}</text></view>
					<view class="flexbetween margin_top1" v-if="item.paypz_image_text">
						<view class="xiaohei main_size">支付憑證</view>
						<image class="listleftimg1 radius" :src="item.paypz_image_text" mode=""
							@click.stop="lbtpriview(0,[item.paypz_image_text])"></image>
					</view>
					<!-- order_status,10=待支付,20=待入住,30=已入住,40=已完成，60已取消 -->
					<view class="flexright xiaohong margin_top1" v-if="Number(item.house_num)!=item.ordergoods.length">
						尚未登入入住訊息{{Number(item.house_num)-item.ordergoods.length}}筆
					</view>
					<view class="flexright">
						<view class="greyBtn margin_top margin_left1" @click.stop="cancelzsOrder(item.id)"
							v-show="item.order_status==10 || item.order_status==20">取消訂單</view>
						<view class="orangeBtn margin_top margin_left1" v-show="item.order_status==10"
							@click.stop="zsjiezhang(item)">結帳</view>
						<view class="orangeBtn margin_top margin_left1" v-show="item.order_status==10"
							@click.stop="pzshow=true;currentid=item.id;uppzflag=5">上傳憑證</view>
						<view class="greyBtn margin_top margin_left1" @click.stop="removezsOrder(item.id)"
							v-show="item.order_status==40 || item.order_status==60">刪除記錄</view>
						<view class="greyBtn margin_top margin_left1"
							v-if="Number(item.house_num)!=item.ordergoods.length"
							@click.stop="sharemsg(item.id,item.shop.name)">
							填寫入住訊息
						</view>
					</view>
				</view>
			</template>
		</view>
		<!-- 票券 -->
		<view class="mainpadding" v-show="headerTabActive==4">
			<view class="border2 ffffff mainpadding margin_bottom3" v-for="(item,index) in 2"
				@click="goTicketsOrderInfo">
				<view class="flexbetween">
					<view class="flexleft">
						<image class="shopImg margin_right1" src="/static/images/order/shop.png" mode=""></image>
						<view class="text_x color_ling margin_right1">万达万达影城（中原万达IMAX店）</view>
						<u-icon name="arrow-right" color="#999" size="16"></u-icon>
					</view>
					<view class="text_x color_red" v-show="tabActive==0">待支付</view>
					<view class="text_x color_red" v-show="tabActive==1">待核銷</view>
					<view class="text_x color_green" v-show="tabActive==2&&index==0">已核銷</view>
					<view class="text_x color_green" v-show="tabActive==2&&index==1">已退款</view>
					<view class="text_x color_jiu" v-show="tabActive==3">已過期</view>
				</view>
				<view class="margin_top flexleft">
					<view class="filmImg margin_right3">
						<image src="/static/goods.png" mode=""></image>
					</view>
					<view class="flex1 justify_between_column" style="height: 228rpx;">
						<view class="text_j color_ling">八角笼中</view>
						<view class="text_five color_jiu" v-show="index==0">座位：5號厅 5排6座 5排7座</view>
						<view class="text_five color_jiu" v-show="index==0">场次：2023-07-17 19:40</view>
						<view class="text_five color_jiu" v-show="index==1">日期：2023-07-17</view>
						<view class="flexbetween">
							<view class="text_five color_jiu">數量：2張</view>
							<view>
								<text class="text_five color_jiu">總價：</text>
								<text class="text_five color_orange">$56</text>
							</view>
						</view>
					</view>
				</view>
				<view class="flexright margin_top padding_top3 line_top">
					<view class="greyBtn" v-show="tabActive==0">取消訂單</view>
					<view class="orangeBtn margin_left1" v-show="tabActive==0&&index==0">我已支付</view>
					<view class="orangeBtn margin_left1" v-show="tabActive==0&&index==1">立即支付</view>
					<view class="greyBtn" v-show="tabActive==1&&index==0" @click="applyShow=true">申請退票</view>
					<view class="greyBtn" v-show="tabActive==1&&index==1">查看進度</view>
					<view class="orangeBtn margin_left1" v-show="tabActive==1">數位票</view>
					<view class="greyBtn" v-show="tabActive==2||tabActive==3">刪除訂單</view>
					<view class="orangeBtn margin_left1" v-show="tabActive==2&&index==0">立即評價</view>
					<view class="orangeBtn margin_left1" v-show="tabActive==2&&index==1">查看評價</view>
				</view>
			</view>
		</view>
		<!-- 查看物流 -->
		<u-popup :show="show" mode="center" round="20" closeOnClickOverlay @close="show=false">
			<view class="popupBox">
				<view class="text text_weight color_ling">查看物流</view>
				<view class="number">
					{{shopfreight_num}}
				</view>
				<view class="copy" @click="copy(shopfreight_num)">點擊複製</view>
			</view>
		</u-popup>
		<!-- 申請退票 -->
		<u-modal :show="applyShow" :title="title" showCancelButton @close="applyShow=false" confirmColor="#FFB800"
			confirmText="確認" cancelText="取消" @cancel="applyShow=false" @confirm="applyShow=false">
			<view class="slot-content">
				<view>
					<text class="text_a color_ling">需要扣除手續費</text>
					<text class="text_a color_theme">$10</text>
					<text class="text_a color_ling">退回金額</text>
					<text class="text_a color_theme">$46</text>
				</view>
				<!-- <view class="text_a color_ling">商家處理中！</view> -->
				<!-- <view class="text_a color_ling">費用已返回~注意查收</view> -->
				<!-- <view class="text_a color_red">原因：目前已經過了这個時間段，已經没有办法再退款了，希望您可以理解！</view> -->
			</view>
		</u-modal>
		<u-modal :show="showConfirm" showCancelButton confirmColor="#ffb800" @cancel="showConfirm=false"
			confirmText="確認" cancelText="取消" @confirm="orderConfirm">
			<view class="slot-content color_ling text_weight text">
				{{text}}
			</view>
		</u-modal>
		<!-- 上傳支付憑證 -->
		<u-modal :show="pzshow" title="上傳憑證" confirmColor="#ffb800" confirmText="確認" @confirm="upconfirm"
			cancelText="取消" @cancel="pzshow=false" showCancelButton>
			<view class="slot-content" style="width: 730rpx;">
				<view class="flexcenter">
					<view class="itemimgBox flexcenter margin_top2" v-for="(item,index) in images_text" :key="index">
						<!-- 已上傳 -->
						<view class="listleftimg1 radius">
							<image class="radius" :src="item" mode=""></image>
							<view class="deleteimg" @click="delindex(index,images,images_text)"></view>
						</view>
					</view>
					<view class="itemimgBox flexcenter margin_top2" @click="uploadImg(1,images,images_text)"
						v-if="images.length<1"><!-- 未上傳 -->
						<image class="listleftimg1 radius" src="@/static/images/mine/noImage.png" mode=""></image>
					</view>
				</view>
			</view>
		</u-modal>
		<tabbar ref="tabbarref" :current="3"></tabbar>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				shopfreight_num: "", //物流單號
				showConfirm: false,
				text: "",
				show: false,
				applyShow: false,
				title: "申請退票",
				systemBarHeight: "",
				headerTabActive: 0,
				tabActive: 0,
				headerTab: [{
						name: "商品",
						listUrl: "/api/Ordergoods/listOrdergoods",
						cancelUrl: "/api/Ordergoods/endOrdergoods",
						removeUrl: "/api/Ordergoods/delOrdergoods",
						shouhuoUrl: "/api/ordergoods/endgoods",
						method: "POST",
						childList: [{
							title: "購物車",
							badge: {
								value: 0,
							}
						}, {
							title: "待支付",
							badge: {
								value: 0,
							}
						}, {
							title: "待接單",
							badge: {
								value: 0,
							}
						}, {
							title: "製作中",
							badge: {
								value: 0,
							}
						}, {
							title: "待取貨",
							badge: {
								value: 0,
							}
						}, {
							title: "配送中",
							badge: {
								value: 0,
							}
						}, {
							title: "待完成",
							badge: {
								value: 0,
							}
						}, {
							title: "已完成",
							badge: {
								value: 0,
							}
						}]
					}, {
						name: "跑腿",
						listUrl: "/api/Orderrun/listOrderrun",
						cancelUrl: "/api/Orderrun/endOrderrun",
						removeUrl: "/api/orderrun/delOrderrun",
						method: "POST",
						childList: [{
							title: "全部",
							badge: {
								value: 0,
							}
						}, {
							title: "未付",
							badge: {
								value: 0,
							}
						}, {
							title: "待收",
							badge: {
								value: 0,
							}
						}, {
							title: "完成",
							badge: {
								value: 0,
							}
						}]
					}, {
						name: "呼叫",
						listUrl: "/api/Ordercall/listOrdercall",
						cancelUrl: "/api/Ordercall/endOrdercall",
						removeUrl: "/api/ordercall/delOrdermake",
						method: "POST",
						childList: [{
							title: "待接單",
							badge: {
								value: 0,
							}
						}, {
							title: "待完成",
							badge: {
								value: 0,
							}
						}, {
							title: "付定金",
							badge: {
								value: 0,
							}
						}, {
							title: "付尾款",
							badge: {
								value: 0,
							}
						}, {
							title: "已完成",
							badge: {
								value: 0,
							}
						}]
					}, {
						name: "預約",
						listUrl: "/api/Ordermake/listOrdermake",
						cancelUrl: "/api/Ordermake/endOrdermake",
						removeUrl: "/api/ordermake/delOrdergoods",
						method: "POST",
						childList: [{
							title: "未到店",
							badge: {
								value: 0,
							}
						}, {
							title: "已到店",
							badge: {
								value: 0,
							}
						}, {
							title: "已完成",
							badge: {
								value: 0,
							}
						}],
						childListzs: [{
							title: "待支付",
							badge: {
								value: 0,
							}
						}, {
							title: "待入住",
							badge: {
								value: 0,
							}
						}, {
							title: "已入住",
							badge: {
								value: 0,
							}
						}, {
							title: "已完成",
							badge: {
								value: 0,
							}
						}]
					},
					// {
					// 	name: "票券",
					// 	childList: [{
					// 		title: "待支付"
					// 	}, {
					// 		title: "待核銷"
					// 	}, {
					// 		title: "已完成"
					// 	}, {
					// 		title: "已過期"
					// 	}]
					// }, 
				],
				page: 1,
				list: {
					data: []
				},
				id: "", //選擇的訂單id
				orderType: 0, //0取消訂單 1刪除訂單
				images: [],
				images_text: [],
				currentid: "",
				pzshow: false,
				uppzflag: 1, //1商品訂單上傳憑證，2呼叫訂單定金上傳，4呼叫訂單尾款上傳，3預約訂單上傳,5住宿订單上传
				ordercall_total_num: 0,
				ordergoods_total_num: 0,
				ordermake_hotel_total_num: 0,
				ordermake_total_num: 0,
				hotel_total_num: 0,
				carAllList: [],
				yystatus: 1, //1預約，2住宿
			}
		},
		computed: {
			tabList() {
				if (this.headerTabActive == 3 && this.yystatus == 1) {
					return this.headerTab[this.headerTabActive].childList
				}
				if (this.headerTabActive == 3 && this.yystatus == 2) {
					return this.headerTab[this.headerTabActive].childListzs
				}
				return this.headerTab[this.headerTabActive].childList
			}
		},
		onLoad(options) {
			uni.hideTabBar()
			this.systemBarHeight = getApp().globalData.systemBarHeight * 2 + 50
			if (options.headerTabActive) {
				this.headerTabActive = options.headerTabActive
				this.tabActive = options.tabActive
			}
		},
		onShow() {
			this.$nextTick(() => {
				this.$refs.tabbarref.init()
			});
			if (httpRequest.checkIsLogin()) {
				this.getList()
			}
		},
		methods: {

			sharemsg(id, shopname) {
				let that = this
				if (navigator.share) {
					navigator.share({
							title: '電囗支付-首創全台最智能POS系統0月租0抽成0設備 線上線下 一網搞定 免操作手機/平板',
							text: shopname,
							url: 'https://opos.tw/pages_order/completejoininfo?id=' + id + '&invite_code=' + uni
								.getStorageSync(
									"invite_code"), // 當前頁面 URL
						})
						.then(() => {
							console.log('分享成功');
						})
						.catch(error => {
							console.error('分享失敗', error);
						});
				} else {
					this.http.toast("當前瀏覽器不支持分享")
				}
			},
			changeyystatus(val) {
				this.yystatus = val
				this.getList()
			},
			fuwuling(item) {
				let that = this
				uni.showLoading({
					mask: true,
					title: "請稍後"
				})
				httpRequest.request('/api/ordermake/callService', 'GET', {
					shop_id: item.shop_id,
					desk: item.desk,
					user_id: uni.getStorageSync('user_id')
				}).then(res => {
					uni.hideLoading()
					if (res.code == 1) {
						httpRequest.toast(res.msg)
					}
				})
			},
			goFinalOrderInfo(cartInfo) { //結帳
				uni.setStorageSync("shop_id", cartInfo.shop_id)
				uni.navigateTo({
					url: "/pages_index/finalOrderInfo?buycar_id=" + cartInfo.shop_id + "&issm=0"
				})
			},
			// 編輯
			edititem(item) { //編輯訂單商品
				uni.setStorageSync("shop_id", item.shop_id)
				let obj = item
				uni.navigateTo({
					url: "/pages_index/goodsInfoEdit?msg=" + encodeURIComponent(JSON.stringify(obj))
				})
				// if (value.type == 0) {
				// 	this.$set(obj, "notes", item.notes)
				// 	uni.navigateTo({
				// 		url: "/pages_index/goodsInfoEdit?msg=" + encodeURIComponent(JSON.stringify(obj))
				// 	})
				// } else {
				// 	uni.navigateTo({
				// 		url: "/pages_index/goodsInfoEditSecond?msg=" + encodeURIComponent(JSON.stringify(obj))
				// 	})
				// }
			},
			async removeCart(id) {
				this.http.modal('提示', '是否確認刪除', true, (resp) => {
					if (resp) {
						uni.showLoading({
							mask: true,
							title: "請稍後"
						})
						this.http.request('/api/goods/delGoodsCart', 'POST', {
							id
						}).then(res => {
							uni.hideLoading()
							if (res.code == 1) {
								this.http.toast("刪除成功！")
								this.getList()
							} else {
								this.http.toast(res.msg)
							}
						})
					}
				})

			},
			uploadImg(value, upImgs, upImgs_text) { //上傳圖片
				let _this = this;
				let num = Number(value) - upImgs.length;
				if (num <= 0) {
					return false;
				}
				uni.showActionSheet({
					itemList: ['照機', '相簿'],
					success: function(res) {
						// 選擇照機走0
						if (res.tapIndex == 0) {
							httpRequest.chooseImage(num, ['camera']).then(res => {
								for (var i = 0; i < res.length; i++) {
									_this.uploadImageService(res[i], upImgs, upImgs_text)
								}
							}).catch(err => {});
						}
						// 選擇相簿走1
						if (res.tapIndex == 1) {
							httpRequest.chooseImage(num, ['album']).then(res => {
								for (var i = 0; i < res.length; i++) {
									_this.uploadImageService(res[i], upImgs, upImgs_text)
								}
							}).catch(err => {});
						}
					},
					fail: function(res) {}
				});
			},
			delindex(index, upImg, upImgs_text) {
				upImg.splice(index, 1)
				upImgs_text.splice(index, 1)
			},
			uploadImageService(url, upImg, upImgs_text) {
				let _this = this;
				this.http.uploadFile('/api/common/upload', url).then(res => {
					let image_item = res.fullurl;
					upImg.push(res.url)
					upImgs_text.push(image_item);
				}).catch(err => {});
			},
			upconfirm() {
				if (this.images.length == 0) {
					httpRequest.toast("請上傳圖片")
				}
				this.pzshow = false
				let url = "/api/ordergoods/updateOrderGoodsData"
				let data = {
					id: this.currentid,
					paypz_image: this.images.join()
				}
				if (this.uppzflag == 2) { //呼叫訂單定金上傳憑證
					url = "/api/Ordercall/updateOrderImage"
					data = {
						id: this.currentid,
						image: this.images.join()
					}
				}
				if (this.uppzflag == 4) { //呼叫訂單尾款上傳憑證
					url = "/api/Ordercall/updateOrderImage"
					data = {
						id: this.currentid,
						image1: this.images.join()
					}
				}
				if (this.uppzflag == 3) { //預約訂單上傳憑證
					url = "/api/Ordermake/updateOrderImage"
					data = {
						id: this.currentid,
						image: this.images.join()
					}
				}
				if (this.uppzflag == 5) { //住宿訂單上傳憑證
					url = "/api/hotel/updateHotelOrderData"
					data = {
						id: this.currentid,
						paypz_image: this.images.join()
					}
				}
				httpRequest.request(url, 'GET', data).then(res => {
					httpRequest.toast(res.msg);
					if (res.code == 1) {
						this.images = []
						this.images_text = []
						this.getList()
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			getorderMsg() {
				let url = "/api/Ordergoods/orderData" //商品
				if (this.headerTabActive == 2) { //呼叫
					url = "/api/Ordercall/orderData"
				}
				if (this.headerTabActive == 3) { //预约
					if (this.yystatus == 1) {
						url = "/api/Ordermake/orderData"
					} else {
						url = "/api/hotel/orderData"
					}
				}
				this.http.request(url, 'GET', {}).then(res => {
					if (this.headerTabActive == 0) { //商品
						this.headerTab[this.headerTabActive].childList[0].badge.value = res.data.gwc_num
						this.headerTab[this.headerTabActive].childList[1].badge.value = res.data.dzf_num
						this.headerTab[this.headerTabActive].childList[2].badge.value = res.data.djd_num
						this.headerTab[this.headerTabActive].childList[3].badge.value = res.data.zzz_num
						this.headerTab[this.headerTabActive].childList[4].badge.value = res.data.dch_num
						this.headerTab[this.headerTabActive].childList[5].badge.value = res.data.psz_num
						this.headerTab[this.headerTabActive].childList[6].badge.value = res.data.fwz_num
						this.headerTab[this.headerTabActive].childList[7].badge.value = res.data.ywc_num
					}
					if (this.headerTabActive == 2) { //呼叫
						this.headerTab[this.headerTabActive].childList[0].badge.value = res.data.djd_num
						this.headerTab[this.headerTabActive].childList[1].badge.value = res.data.fwz_num
						this.headerTab[this.headerTabActive].childList[2].badge.value = res.data.wfdj_num
						this.headerTab[this.headerTabActive].childList[3].badge.value = res.data.wfwk_num
					}
					if (this.headerTabActive == 3) { //预约
						if (this.yystatus == 1) {
							this.headerTab[this.headerTabActive].childList[0].badge.value = res.data.wdd_num
							this.headerTab[this.headerTabActive].childList[1].badge.value = res.data.ydd_num
						} else {
							this.headerTab[this.headerTabActive].childListzs[0].badge.value = res.data.dzf_num
							this.headerTab[this.headerTabActive].childListzs[1].badge.value = res.data.drz_num
							this.headerTab[this.headerTabActive].childListzs[2].badge.value = res.data.yrz_num
						}

					}
				})
			},
			getorderAllMsg() {
				let url = "/api/user/getOrderTotalData" //全部點數据
				this.http.request(url, 'GET', {}).then(res => {
					this.ordercall_total_num = res.data.ordercall_total_num
					this.ordergoods_total_num = res.data.ordergoods_total_num
					this.ordermake_hotel_total_num = res.data.ordermake_hotel_total_num
					this.ordermake_total_num = res.data.ordermake_total_num
					this.hotel_total_num = res.data.hotel_total_num
				})
			},
			async getList(isPage, page) { //訂單列表
				this.getorderMsg()
				this.getorderAllMsg()
				let _this = this
				let url = this.headerTab[this.headerTabActive].listUrl
				let method = this.headerTab[this.headerTabActive].method
				let obj = {}
				let data = {}
				if (this.headerTabActive == 0) { //商品
					obj = {
						"0": "100", //購物車
						"1": "0", //待支付
						"2": 1, //待接單
						"3": 2, //已接單/製作中
						"4": 5, //待取貨
						"5": '6,7,8', //配送中
						"6": '87', //待完成
						"7": "9,88,99", //已完成
					}
					data = {
						page: page || 1,
						limit: 12,
						status: obj[this.tabActive],
					}
					if (this.tabActive == 0) {
						url = "/api/goods/goodsCart"
						data = {}
					}
				} else if (this.headerTabActive == 1) { //跑腿
					obj = {
						"0": "", //全部
						"1": 0, //未付
						"2": 1, //代收
						"3": 2, //完成
					}
					data = {
						page: page || 1,
						limit: 12,
						status: obj[this.tabActive],
					}
				} else if (this.headerTabActive == 2) { //呼叫
					obj = {
						"0": 0, //待服務
						"1": 3, //付定金
						"2": 87, //待完成
						"3": 4, //付尾款
						"4": "99,88", //已完成
					}
					data = {
						page: page || 1,
						limit: 12,
						status: obj[this.tabActive],
					}
				} else if (this.headerTabActive == 3) { //預約
					if (this.yystatus == 1) {
						obj = {
							"0": 0, //未到店
							"1": "1,2", //已到店
							"2": 99, //已完成
						}
						data = {
							page: page || 1,
							limit: 12,
							status: obj[this.tabActive],
						}
					} else { //酒店
						url = "/api/hotel/orderIndex"
						obj = {
							"0": 10, //待支付
							"1": 20, //待入住
							"2": 30, //已入住
							"3": 40, //已完成
						}
						data = {
							page: page || 1,
							limit: 12,
							order_status: obj[this.tabActive],
							data_type: 2
						}
						console.log(this.tabActive, "驚雷");
					}
				}
				let res = await this.http.request(url, method, data)
				if (res.code == 1) {
					if (this.headerTabActive == 0 && this.tabActive == 0) { //购物车點數据
						this.carAllList = res.data
						return false
					}
					if (this.headerTabActive == 3 && this.yystatus == 1) {
						res.data.data.forEach(item => {
							let price = 0
							if (item.order_goods_list.length) {
								item.order_goods_list.forEach(ite => {
									ite.logoimage = this.imgUrl + ite.logoimage
									price = Number(price) + Number(ite.price)
								})
							}
							this.$set(item, "allprice", price)
						})
					}
					let resList = res.data;
					let dataList = _this.list;
					if (isPage == true) {
						_this.list.data = dataList.data.concat(resList.data);
					} else {
						_this.list = res.data
						_this.list.data = resList.data;
					}
				} else if (res.code == 0) {
					this.list.data = []
					if (this.headerTabActive == 0 && this.tabActive == 0) { //购物车點數据
						this.carAllList = []
						return false
					}
					// this.http.toast(res.msg)
				} else {
					this.http.toast('系統處理中，請稍後再試');
				}
			},
			onReachBottom() {
				if (this.headerTabActive == 0 && this.tabActive == 0) { //购物车點數据
					return false
				}
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.getList(true, page);
			},
			selectTab(index) { //一级tab切換
				this.tabActive = 0
				this.headerTabActive = index
				this.page = 1
				this.list = {
					data: []
				}
				this.getList()
				console.log(this.tabActive)
			},
			change(e) { //二级tab切換
				this.tabActive = e.index
				this.page = 1
				this.list = {
					data: []
				}
				this.getList()
			},
			goShopInfo(id) {
				uni.navigateTo({
					url: "/pages_index/shopInfo?id=" + id
				})
			},
			// 商品訂單開始
			oncePay(item) { //立即付款
				uni.navigateTo({
					url: "/pages_index/payment?msg=" + encodeURIComponent(JSON.stringify({
						id: item.id,
						paymoney: item.zhuimoney,
						order_type: 0,
						shop_id: item.shop_id,
						call_no: item.call_no
					}))
				})
			},
			xzth(id) {
				uni.navigateTo({
					url: "/pages_order/xuanzezt?id=" + id
				})
			},
			jxPay(item) { //商品訂單繼續付款
				uni.navigateTo({
					url: "/pages_index/payment?msg=" + encodeURIComponent(JSON.stringify({
						id: item.id,
						paymoney: item.zhuimoney,
						order_type: 1,
						shop_id: item.shop_id,
						call_no: item.call_no
					}))
				})
			},
			jiezhang(item) { //預約訂單結帳
				uni.navigateTo({
					url: "/pages_index/payment?msg=" + encodeURIComponent(JSON.stringify({
						id: item.id,
						paymoney: item.order_goods.zhuimoney,
						order_type: 4,
						shop_id: item.shop_id,
						call_no: item.call_no
					}))
				})
			},
			zsjiezhang(item) { //住宿訂單結帳
				uni.navigateTo({
					url: "/pages_index/payment?msg=" + encodeURIComponent(JSON.stringify({
						id: item.id,
						paymoney: item.pay_price,
						order_type: 6,
						shop_id: item.shop_id,
						call_no: "暫時寫死"
					}))
				})
			},
			paypt(item) { //跑腿訂單付款
				let data1 = {
					id: item.id,
					paymoney: item.z_money,
					order_type: 5,
					dyzf: 1,
					call_no: item.call_no
				}
				uni.navigateTo({
					url: "/pages_index/payment?msg=" + encodeURIComponent(JSON.stringify(data1))
				})
			},
			overptdd(item) {
				this.http.modal('提示', '是否確認完成訂單', true, (resp) => {
					if (resp) {
						this.http.request("/api/orderrun/wanOrderrun", 'POST', {
							id: item.id
						}).then(res => {
							if (res.code == 1) {
								this.http.toast("操作成功")
								this.getList()
							} else if (res.code == 0) {
								this.http.toast(res.msg)
							} else {
								this.http.toast('系統處理中，請稍後再試');
							}
						})
					}
				})
			},
			Paywk(item) { //付尾款
				uni.navigateTo({
					url: "/pages_index/payment?msg=" + encodeURIComponent(JSON.stringify({
						id: item.id,
						paymoney: item.w_money,
						shop_id: item.shop_id,
						order_type: 2,
						call_no: item.call_no
					}))
				})
			},
			Paydj(item) { //付定金
				uni.navigateTo({
					url: "/pages_index/payment?msg=" + encodeURIComponent(JSON.stringify({
						id: item.id,
						paymoney: item.d_money,
						shop_id: item.shop_id,
						order_type: 3,
						call_no: item.call_no
					}))
				})
			},
			cancelOrder(id) { //商品、預約取消訂單
				this.id = id
				this.text = "您確定要取消此訂單吗？"
				this.orderType = 0
				this.showConfirm = true
			},
			cancelzsOrder(id) { //酒店取消訂單
				this.http.modal('提示', '是否確認取消訂單', true, (resp) => {
					if (resp) {
						this.http.request("/api/hotel/cancelOrder", 'GET', {
							id
						}).then(res => {
							if (res.code == 1) {
								this.http.toast("操作成功")
								this.getList()
							} else if (res.code == 0) {
								this.http.toast(res.msg)
							} else {
								this.http.toast('系統處理中，請稍後再試');
							}
						})
					}
				})
			},
			removezsOrder(id) { //酒店刪除訂單
				this.http.modal('提示', '是否確認刪除訂單', true, (resp) => {
					if (resp) {
						this.http.request("/api/hotel/delOrder", 'GET', {
							id
						}).then(res => {
							if (res.code == 1) {
								this.http.toast("操作成功")
								this.getList()
							} else if (res.code == 0) {
								this.http.toast(res.msg)
							} else {
								this.http.toast('系統處理中，請稍後再試');
							}
						})
					}
				})
			},
			removeOrder(id) { //商品、預約刪除訂單
				this.id = id
				this.text = "您確定要刪除此訂單吗？"
				this.orderType = 1
				this.showConfirm = true
			},
			suresh(id) { //確認收貨
				this.id = id
				this.text = "確認收到貨了吗？"
				this.orderType = 2
				this.showConfirm = true
			},
			copy(value) {
				this.show = false
				uni.setClipboardData({
					data: value.toString(), //要被複製的内容
					success: () => {
						//複製成功的回调函數
						this.http.toast("複製成功")
					}
				});
			},
			async orderConfirm() { //確認 取消訂單/刪除訂單
				let url = "",
					text = "";
				if (this.orderType == 0) {
					url = this.headerTab[this.headerTabActive].cancelUrl
					text = "取消成功"
				} else if (this.orderType == 1) {
					url = this.headerTab[this.headerTabActive].removeUrl
					text = "刪除成功"
				}
				if (this.orderType == 2) {
					url = this.headerTab[this.headerTabActive].shouhuoUrl
					text = "收貨成功"
				}
				let _this = this
				let res = await this.http.request(url, 'POST', {
					id: this.id
				})
				if (res.code == 1) {
					this.http.toast(text)
					this.showConfirm = false
					// let index = this.list.data.findIndex(item => {
					// 	return item.id == this.id
					// })
					// this.list.data.splice(index, 1)
					this.getList()
				} else if (res.code == 0) {
					this.http.toast(res.msg)
				} else {
					this.http.toast('系統處理中，請稍後再試');
				}
			},
			goGoodsOrderInfo(id) { //商品訂單詳情
				uni.navigateTo({
					url: "/pages_order/goodsOrderInfo?id=" + id
				})
			},
			goPublishEvaluate(item, val) { //發表評價
				let data = {
					type: val, //val：1商品訂單，2跑腿訂單，3呼叫訂單，4預約訂單，5票券
					qs_ishow: false,
					id: item.id
				}
				if (val == 1) { //商品訂單
					// type 0外送，1自取，2内用
					// 判断他的狀態是否外送并且是否有騎手，有展示騎手評價否则不显示騎手評價
					if ((item.type == 0 && item.ps_type == 1) || (item.type == 0 && item.ps_type == 2)) {
						data.qs_ishow = true
					} else {
						data.qs_ishow = false
					}
				}
				if (val == 2) { //商品訂單
					data.qs_ishow = true
				}
				uni.navigateTo({
					url: "/pages_order/publishEvaluate?msg=" + encodeURIComponent(JSON.stringify(data))
				})
			},
			// 商品訂單結束
			goRunErrandsOrderInfo(id) { //跑腿訂單詳情
				uni.navigateTo({
					url: "/pages_order/runErrandsOrderInfo?id=" + id
				})

			},
			goCallOrderInfo(item) { //呼叫訂單詳情
				if (item.status == 88) return false
				uni.navigateTo({
					url: "/pages_order/callOrderInfo?id=" + item.id
				})
			},
			goyuyueOrderInfo(id) { //預約訂單詳情
				uni.navigateTo({
					url: "/pages_order/yuyueorderInfo?id=" + id
				})
			},
			// 預約訂單開始
			async reach(item) { //到達
				uni.navigateTo({
					url: "/pages_order/yuyuedaoda?id=" + item.id + "&shop_id=" + item.shop_id
				})
			},
			goSelectGoods(shopid, order_id) { //點餐選擇商品
				uni.setStorageSync("reservation_order_id", order_id)
				uni.navigateTo({
					url: "/pages_order/selectGoodsList?id=" + shopid
				})
			},
			gocdbSelectGoods(id, order_id, cdbtc_id) {
				uni.setStorageSync("order_make_id", order_id)
				uni.navigateTo({
					url: "/pages_mine/zizhucan?cdbtc_id=" + cdbtc_id + "&shop_id=" + id
				})
			},
			// 預約訂單結束
			goTicketsOrderInfo() { //票券詳情
				uni.navigateTo({
					url: "/pages_order/ticketsOrderInfo"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.number {
		padding: 5rpx 30rpx;
		background: rgba(255, 133, 5, 0.1);
		border-radius: 0rpx 14rpx 0rpx 14rpx;
		position: absolute;
		top: 0;
		right: 0;
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FF8505;
	}

	::v-deep.u-badge {
		// width: 15rpx !important;
	}

	.box {
		position: absolute;
		top: -5rpx;
		right: -5rpx;
	}


	.listleftimg1 {
		width: 150rpx;
		min-width: 150rpx;
		height: 150rpx;
		position: relative;

		image {
			width: 100%;
			height: 100%;
		}
	}

	// 一级tab栏
	.header {
		box-sizing: border-box;
	}

	.headerBox {
		padding: 6rpx;
		box-sizing: border-box;
		background: #F1F1F1;
		border-radius: 72rpx 72rpx 72rpx 72rpx;
		font-size: 30rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;

		view {
			width: 20%;
			text-align: center;
		}

		.select {
			width: 20%;
			height: 74rpx;
			line-height: 74rpx;
			text-align: center;
			background: #ffb800;
			border-radius: 72rpx 72rpx 72rpx 72rpx;
			font-size: 30rpx;
			font-family: PingFang SC-Heavy, PingFang SC;
			font-weight: 800;
			color: #000000;
		}

		.noselect {
			width: 20%;
			height: 74rpx;
			line-height: 74rpx;
			text-align: center;
			background: #f1f1f1;
			border-radius: 72rpx 72rpx 72rpx 72rpx;
		}
	}

	// 二级tab栏
	::v-deep.u-tabs__wrapper__nav__item {
		flex: 1;
		white-space: nowrap;
	}

	::v-deep.u-tabs {
		padding: 0 20rpx;
	}

	// 訂單列表
	.shopImg {
		width: 26.62rpx;
		height: 24rpx;
		min-width: 26.62rpx;
	}

	.priceBox {
		background: #F8F8F8;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}

	.stateBox {
		width: 88rpx;
		height: 46rpx;
		line-height: 46rpx;
		text-align: center;
		border-radius: 15rpx 51rpx 51rpx 0rpx;
	}

	.color1 {
		color: #FF8505;
		background: rgba(255, 133, 5, 0.1);
	}

	.color2 {
		color: #BD00FF;
		background: rgba(189, 0, 255, 0.1);
	}

	.color3 {
		background: rgba(22, 158, 0, 0.1);
	}

	.takeBox {
		width: 40rpx;
		height: 40rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	::v-deep.u-modal__title {
		font-size: 32rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
	}

	.popupBox {
		width: 583rpx;
		padding-top: 50rpx;

		.number {
			width: 514rpx;
			height: 84rpx;
			line-height: 84rpx;
			text-align: center;
			border-radius: 6rpx 6rpx 6rpx 6rpx;
			border: 2rpx solid #E6E8EB;
			margin: 100rpx auto 0;
			font-size: 28rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #000000;
		}

		.copy {
			width: 100%;
			text-align: center;
			padding: 30rpx 0;
			background-color: rgba(255, 184, 0, 1);
			margin-top: 90rpx;
			border-radius: 0 0 20rpx 20rpx;
			font-size: 30rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #000000;
		}
	}

	.slot-content {
		margin: 50rpx 0;
	}

	.all1 {
		background: #fFF;
		border-radius: 11rpx 0rpx 0rpx 11rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FF8505;
		padding: 11rpx 38rpx;
		border: 2rpx solid #FF8505;
		position: relative;
	}

	.all3 {
		background: #fFF;
		border-radius: 0rpx 11rpx 11rpx 0rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FF8505;
		padding: 11rpx 38rpx;
		border: 2rpx solid #FF8505;
		position: relative;
	}

	.checkall {
		background-color: #FF8505 !important;
		color: #fff !important;
	}

	.goodsImg {
		width: 157rpx;
		height: 157rpx;
		min-width: 157rpx;
		position: relative;

		image {
			width: 100%;
			height: 100%;
			border-radius: 14rpx;
		}

		.shipment {
			// width: 71rpx;
			// height: 30rpx;
			// line-height: 30rpx;
			padding: 4rpx;
			box-sizing: border-box;
			text-align: center;
			background: #13C463;
			border-radius: 14rpx 0rpx 14rpx 0rpx;
			font-size: 18rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			position: absolute;
			left: 0;
			top: 0;
		}
	}

	.price {
		font-size: 30rpx;
		font-family: DIN Next LT Pro-Bold, DIN Next LT Pro;
		font-weight: bold;
		color: #FF5C00;
	}

	.filmImg {
		width: 164rpx;
		height: 228rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 6rpx;
		}
	}

	::v-deep .u-transition {
		z-index: 900 !important;
	}

	.shareBtn {
		border-radius: 30rpx;
		padding: 5rpx 50rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FF5C00;
		border: 1rpx solid #FF5C00;
		background-color: red;
	}
</style>